package exception;
/*异常常用方法*/
public class ExceptionApiDemo {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try {//ctr+alt+t  包围制定代码
            String s = "qwe";
            System.out.println(Integer.parseInt(s));//NumberFormatException
        } catch (NumberFormatException e) {
            e.printStackTrace();//打印栈的跟踪信息
            System.out.println(e.getMessage());//获取错误消息  给用户做提示
        }
        System.out.println("程序结束");
    }
}
